<div class="main-title">
    <h1 class="float-left">Designations</h1>
</div>
<div class="grid_16">
	<?php if (!empty($hierarchies)): ?>
		<?php foreach ($hierarchies as $hierarchy) : ?>
			<div class="section">
				<div class="block">
					<h2><?php echo $hierarchy->name; ?></h2>
					<h4>
						Effective from: 
						<?php echo Yii::app()->dateFormatter->formatDateTime(strtotime($hierarchy->from_date), "short", null); ?> to 
						<?php echo ($hierarchy->to_date ? Yii::app()->dateFormatter->formatDateTime(strtotime($hierarchy->to_date), "short", null) : 'Present' ) ?>
					</h4>
					<br/>
					<?php
					$this->widget('PsGridView', array(
						'id' => 'admin-designations-grid',
						'dataProvider' => $this->getDesignationDataProvider($hierarchy->id),
						'template' => '{items}{pager}',
						'pagerCssClass' => 'pager float-right',
						'pagesizeCssClass' => 'pager-pagesize float-right',
						'htmlOptions' => array(
							'class' => 'grid-view grey'
						),
						'columns' => array(
							'pos' => array(
								'header' => 'Rank',
								'name' => 'pos',
								'value' => '$data->pos',
								'htmlOptions' => array(
									'width' => 50,
								)
							),
							'name' => array(
								'header' => 'Title',
								'name' => 'name',
								'type' => 'raw',
								'value' => '"<strong>" .$data->name. "</strong>"'
							),
							'abbreviation' => array(
								'header' => 'Abbrevation',
								'name' => 'abbreviation',
								'value' => '$data->abbreviation ? $data->abbreviation : "-"',
								'htmlOptions' => array(
									'width' => '100'
								)
							),
							'num_users' => array(
								'header' => 'No. of Users',
								'value' => '$data->getUsersCount()'
							)
						)
					));
					?>
				</div>
			</div>
		<?php endforeach; ?>
	<?php else: ?>
		<div class="box">
			<div class="grid_12">
				<h3>No Career Paths Found</h3>
			</div>
		</div>
	<?php endif; ?>
</div>